package com.adapter.demo03;

import java.util.Enumeration;
import java.util.Iterator;

/**
 * 适配器角色:
 * 将Iterator接口适配成Enumeration接口
 */
public class Itermeration implements Enumeration {
    Iterator it;
    public Itermeration(Iterator it){
        this.it = it;
    }
    @Override
    public boolean hasMoreElements() {
        return it.hasNext();
    }

    @Override
    public Object nextElement() {
        return it.next();
    }
}
